<?php

/*
 * Copyright (c) Madbit 2012. All Rights Reserved.
 * Reproduction in whole or in part is prohibited without the
 * written consent of the copyright owner.
 */

function deldir($dir){
  $current_dir = opendir($dir); 
  while($entryname = readdir($current_dir)){ 
     if(is_dir("$dir/$entryname") and ($entryname != "." and $entryname!="..")){ 
       deldir("${dir}/${entryname}"); 
     }elseif($entryname != "." and $entryname!=".."){ 
       unlink("${dir}/${entryname}"); 
     } 
  } 
  closedir($current_dir); 
  rmdir(${dir}); 
}

?>
